(function() {
    'use strict';

    angular
        .module('milkbeeApp')
        .controller('EstateController', EstateController);

    EstateController.$inject = ['$scope', '$state', 'Estate'];

    function EstateController ($scope, $state, Estate) {
        var vm = this;

        vm.estates = [];

        loadAll();

        function loadAll() {
            Estate.query(function(result) {
                vm.estates = result;
                vm.searchQuery = null;
            });
        }
    }
})();
